package com.hub.utils.enums;

import lombok.Getter;

@Getter
public enum UserGenderEnum {
    UNKNOWN(1,"未知"),
    FEMALE(2,"女"),
    MALE(3,"男");

    private int code;
    private String description;

    UserGenderEnum(int code, String desc) {
        this.code = code;
        this.description = desc;
    }

    /**
     * 获取枚举值的描述
     * @param index
     * @return
     */
    public static String getDescription(int index) {
        for(UserGenderEnum uge : UserGenderEnum.values()){
            if(uge.getCode() == index){
                   return uge.description;
            }
        }
        return "位置编码";
    }
}
